package tr.edu.metu.is.mega.server.service;

import java.util.List;

import tr.edu.metu.is.mega.client.service.GwtLectureNoteService;
import tr.edu.metu.is.mega.common.dto.CourseDTO;
import tr.edu.metu.is.mega.common.dto.LectureNoteDTO;
import tr.edu.metu.is.mega.server.business.LectureNoteManager;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * Implementation of GWT lecture note service.
 */
public class GwtLectureNoteServiceImpl extends RemoteServiceServlet implements GwtLectureNoteService {

    private static final long serialVersionUID = 9013850437602576118L;

    private final LectureNoteManager manager;

    /**
     * Default constructor.
     */
    public GwtLectureNoteServiceImpl() {
        manager = new LectureNoteManager();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public LectureNoteDTO createLectureNote(LectureNoteDTO lectureNote) {
        return manager.createLectureNote(lectureNote);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public LectureNoteDTO updateLectureNote(LectureNoteDTO lectureNote) {
        return manager.updateLectureNote(lectureNote);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void deleteLectureNote(LectureNoteDTO lectureNote) {
        manager.deleteLectureNote(lectureNote);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<LectureNoteDTO> getLectureNotes(CourseDTO course) {
        return manager.getLectureNotes(course);
    }
}
